{include file="../_meta" /}
<body style="padding:3px;">
<table id="easyui_dg" class="easyui-datagrid" closable="true"></table>
<!-- 查看二维码 -->
<div id="dlg-qrcode" class="easyui-dialog" title="查看二维码" data-options="iconCls:'icon-ok'" style="width:335px;height:380px;padding:0px;margin:0px;" closed="true">
	<img id="img-qrcode" style="width:320px;height:320px;" src="">
</div>


<div id="dlg" data-options="iconCls:'icon-add'"></div>
<div id="dlg-train" data-options="iconCls:'icon-add'"></div>	


<script type="text/javascript">

// 操作栏目信息
function formatOperationShow(val,row,ind){
	return '<span style="padding-left:10px;cursor:pointer;" onclick="importExcelFile(\''+row.id+'\')"><img src="/static/images/add.jpg" title="导入此文件数据"></span>';
}

function importExcelFile(id = 0) {

	if(id != 0) {
		$.messager.confirm('导入确认','您确定导入文件里的用户信息?',function(r){
			if (r){
				$.ajax({
					url: 'excelDo',
					type: "GET",
					dataType: 'json',
					data: {
						excelId: id
					},
					success: function (obj) {
						if(obj.code) {
							$.messager.show({
								title: '导入成功',
								msg: obj.msg
							});
						} else {
							$.messager.show({
								title: '导入失败',
								msg: obj.errMsg
							});
						};			
						$('#easyui_dg').datagrid('reload');	// reload the user data
					}
				});
			} else {
				return false;
			}
		});
	}
	
};

// 格式化列数据
function formatStatusShow(val,row,ind) {		
	if (val == 1){
		return '<span style="color:green;">未导入</span>';
	} else if(val == 2) {
		return '<span style="color:navy;">导入成功</span>';
	}	 else if(val == 3) {
		return '<span style="color:orange;">已删除</span>';
	}	 else if(val == 4) {
		return '<span style="color:red;">文件作废</span>';
	}	
}
// '1:未导入,2:导入成功,3:删除,4:作废',

// 添加
function add(){
	$('#dlg').dialog({
		title: '添加',
		width: 460,
		height: 340,
		closed: false,
		closable:false,
		cache: false,
		content: "<iframe scrolling='auto' frameborder='0' src='excelImport' style='width:100%; height:100%; display:block;'></iframe>",
		modal: true
	});
};



// dataGrid 工具栏
var toolbar = [{
		text:'上传Excel文件',
		iconCls:'icon-add',
		handler:function(){ add();}
	}];
	
// 数据栅格
$('#easyui_dg').datagrid({
	loadMsg:"数据加载中,请稍后",
	url:"excelIndexLoad",
	rownumbers:true,
	toolbar: toolbar,
	pagination:true,
	singleSelect:true,
	fit:true,
	fitColumns:true,
	striped:true,
	pageSize:15,
	pageList:[15,20,30,40,50,100],
    columns:[[
		{field:'import_no',title:'上传批次',width:60,align:'center'},
		{field:'original_name',title:'上传文件',width:100,align:'left'},
		{field:'import_datetime',title:'上传时间',width:60,align:'center'},
		{field:'file_status',title:'文件状态',width:30,align:'center',formatter:formatStatusShow},
		{field:'file_rows',title:'文件行数',width:30,align:'center'},
		{field:'import_rows',title:'导入行数',width:30,align:'center'},
		{field:'import_date',title:'导入时间',width:60,align:'center'},
		{field:'operation',title:'操作',width:40,align:'center',formatter:formatOperationShow},
		{field:'memo',title:'备注',width:30,align:'left'},
    ]]
});


</script>			
			
</body>
</html>
























